gtk-demo: Drop the modelbutton demo
authorMatthias Clasen <mclasen@redhat.com>
Sun, 9 Aug 2020 14:59:22 +0000 (10:59 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 9 Aug 2020 14:59:22 +0000 (10:59 -0400)
Not a public api, so shouldn't be featured in a demo.

demos/gtk-demo/demo.gresource.xml
demos/gtk-demo/meson.build
demos/gtk-demo/modelbutton.c [deleted file]
demos/gtk-demo/modelbutton.ui [deleted file]

index 0ec808bd962489449e829160f03840c57ffe2341..4cfc704db572aa67809bdfd79a3b1176d8ba034f 100644 (file)
     <file>listview_words.c</file>
     <file>list_store.c</file>
     <file>markup.c</file>
-    <file>modelbutton.c</file>
     <file>overlay.c</file>
     <file>overlay2.c</file>
     <file>paint.c</file>
   <gresource prefix="/scale">
     <file>scale.ui</file>
   </gresource>
-  <gresource prefix="/modelbutton">
-    <file>modelbutton.ui</file>
-  </gresource>
   <gresource prefix="/tagged_entry">
     <file>demotaggedentry.c</file>
     <file>demotaggedentry.h</file>
index 0b419edb21ac7f79e07927776a27e2cad68fe6b3..8eaf7090da07b4c875af432bfe50cbfb0f70c77d 100644 (file)
@@ -51,7 +51,6 @@ demos = files([
   'listview_weather.c',
   'listview_words.c',
   'markup.c',
-  'modelbutton.c',
   'overlay.c',
   'overlay2.c',
   'paint.c',
diff --git a/demos/gtk-demo/modelbutton.c b/demos/gtk-demo/modelbutton.c
deleted file mode 100644 (file)
index 055189a..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Model Button
- *
- * GtkModelButton is a button widget that is designed to be used with
- * a GAction as model. The button will adjust its appearance according
- * to the kind of action it is connected to.
- *
- * It is also possible to use GtkModelButton without a GAction. In this
- * case, you should set the "role" attribute yourself, and connect to the
- * "clicked" signal as you would for any other button.
- *
- * A common use of GtkModelButton is to implement menu-like content
- * in popovers.
- */
-
-#include <gtk/gtk.h>
-
-void
-modelbutton_tool_clicked (GtkButton *button)
-{
-  gboolean active;
-
-  g_object_get (button, "active", &active, NULL);
-  g_object_set (button, "active", !active, NULL);
-}
-
-GtkWidget *
-do_modelbutton (GtkWidget *do_widget)
-{
-  static GtkWidget *window = NULL;
-  static GActionEntry win_entries[] = {
-    { "color", NULL, "s", "'red'", NULL },
-    { "chocolate", NULL, NULL, "true", NULL },
-    { "vanilla", NULL, NULL, "false", NULL },
-    { "sprinkles", NULL, NULL, NULL, NULL }
-  };
-
-  if (!window)
-    {
-      GtkBuilder *builder;
-      GActionGroup *actions;
-
-      builder = gtk_builder_new_from_resource ("/modelbutton/modelbutton.ui");
-      window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
-      gtk_window_set_display (GTK_WINDOW (window),
-                              gtk_widget_get_display (do_widget));
-      g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
-
-      actions = (GActionGroup*)g_simple_action_group_new ();
-      g_action_map_add_action_entries (G_ACTION_MAP (actions),
-                                       win_entries, G_N_ELEMENTS (win_entries),
-                                       window);
-      gtk_widget_insert_action_group (window, "win", actions);
-
-
-      g_object_unref (builder);
-    }
-
-  if (!gtk_widget_get_visible (window))
-    gtk_widget_show (window);
-  else
-    gtk_window_destroy (GTK_WINDOW (window));
-
-
-  return window;
-}
-
diff --git a/demos/gtk-demo/modelbutton.ui b/demos/gtk-demo/modelbutton.ui
deleted file mode 100644 (file)
index 12593a2..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <object class="GtkWindow" id="window1">
-    <property name="title" translatable="yes">Model Button</property>
-    <property name="resizable">0</property>
-    <child type="titlebar">
-      <object class="GtkHeaderBar"/>
-    </child>
-    <child>
-      <object class="GtkBox">
-        <property name="orientation">vertical</property>
-        <property name="margin-start">80</property>
-        <property name="margin-end">80</property>
-        <property name="margin-top">80</property>
-        <property name="margin-bottom">80</property>
-        <child>
-          <object class="GtkMenuButton">
-            <property name="popover">thing_a</property>
-            <property name="label">_Color</property>
-            <property name="use-underline">1</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkMenuButton">
-            <property name="popover">thing_b</property>
-            <property name="label">_Flavors</property>
-            <property name="use-underline">1</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkMenuButton">
-            <property name="popover">thing_c</property>
-            <property name="label">_Tools</property>
-            <property name="use-underline">1</property>
-          </object>
-        </child>
-      </object>
-    </child>
-  </object>
-  <object class="GtkPopover" id="thing_a">
-    <style>
-      <class name="menu"/>
-    </style>
-    <child>
-      <object class="GtkBox">
-        <property name="orientation">vertical</property>
-        <child>
-          <object class="GtkModelButton">
-            <property name="action-name">win.color</property>
-            <property name="action-target">&apos;red&apos;</property>
-            <property name="text">Red</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkModelButton">
-            <property name="action-name">win.color</property>
-            <property name="action-target">&apos;green&apos;</property>
-            <property name="text">Green</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkModelButton">
-            <property name="action-name">win.color</property>
-            <property name="action-target">&apos;blue&apos;</property>
-            <property name="text">Blue</property>
-          </object>
-        </child>
-      </object>
-    </child>
-  </object>
-  <object class="GtkPopover" id="thing_b">
-    <style>
-      <class name="menu"/>
-    </style>
-    <child>
-      <object class="GtkBox">
-        <property name="orientation">vertical</property>
-        <child>
-          <object class="GtkModelButton">
-            <property name="action-name">win.chocolate</property>
-            <property name="text">Chocolate</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkModelButton">
-            <property name="action-name">win.vanilla</property>
-            <property name="text">Vanilla</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkSeparator"/>
-        </child>
-        <child>
-          <object class="GtkModelButton">
-            <property name="action-name">win.sprinkles</property>
-            <property name="text">Add Sprinkles</property>
-          </object>
-        </child>
-      </object>
-    </child>
-  </object>
-  <object class="GtkPopover" id="thing_c">
-    <style>
-      <class name="menu"/>
-    </style>
-    <child>
-      <object class="GtkBox">
-        <property name="orientation">vertical</property>
-        <child>
-          <object class="GtkModelButton">
-            <property name="text">Hammer</property>
-            <property name="role">check</property>
-            <signal name="clicked" handler="modelbutton_tool_clicked"/>
-          </object>
-        </child>
-        <child>
-          <object class="GtkModelButton">
-            <property name="text">Screwdriver</property>
-            <property name="role">check</property>
-            <signal name="clicked" handler="modelbutton_tool_clicked"/>
-          </object>
-        </child>
-        <child>
-          <object class="GtkModelButton">
-            <property name="text">Drill</property>
-            <property name="role">check</property>
-            <signal name="clicked" handler="modelbutton_tool_clicked"/>
-          </object>
-        </child>
-      </object>
-    </child>
-  </object>
-</interface>